package org.oos.atom.entries.impl;

import java.util.Date;

import org.oos.atom.elements.AbstractOosEntry;
import org.oos.atom.entries.OfferEntry;
import org.oos.util.AtomDate;

import com.google.api.client.util.Key;

public class OfferEntryImpl extends AbstractOosEntry implements OfferEntry,
		Cloneable {

	private static final long serialVersionUID = 3860784981493685360L;

	@Key("oos:serviceSlug")
	protected String serviceSlug;
	@Key("oos:validFrom")
	protected String validFrom = null;
	protected Date validFromDate = null;
	@Key("oos:validTo")
	protected String validTo = null;
	protected Date validToDate = null;
	@Key("oos:offerType")
	protected String offerType;
	@Key("oos:description")
	protected String description;
	@Key("oos:conditions")
	protected String conditions;
	@Key("oos:signups")
	protected Integer signups;
	@Key("oos:value")
	protected String value;

	@Override
	public String getServiceSlug() {
		return serviceSlug;
	}

	@Override
	public Date getValidFrom() {
		if (validFromDate == null && validFrom != null) {
			validFromDate = new AtomDate(validFrom);
		}
		return validFromDate;
	}

	@Override
	public Date getValidTo() {
		if (validToDate == null && validTo != null) {
			validToDate = new AtomDate(validTo);
		}
		return validToDate;
	}

	@Override
	public String getOfferType() {
		return offerType;
	}

	@Override
	public String getDescription() {
		return description;
	}

	@Override
	public String getConditions() {
		return conditions;
	}

	@Override
	public Integer getSignups() {
		return signups;
	}

	@Override
	public String getValue() {
		return value;
	}

}
